﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace brand.admin.cyt369.com.services.ORM
{
    public partial class BaseContext: Microsoft.EntityFrameworkCore.DbContext
    {
        public BaseContext() { }

        public BaseContext(DbContextOptions<BaseContext> options) : base(options)
        {
        }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
                if (Admin.CYT369.Com.Utility.SystemSettingService.Instance.base_admin_cyt369_com_connection_string.DBType == "SQLSERVER2008")
                {
                    optionsBuilder.UseSqlServer(Admin.CYT369.Com.Utility.SystemSettingService.Instance.base_admin_cyt369_com_connection_string.ConnectionString).ReplaceService<Microsoft.EntityFrameworkCore.Query.IQueryTranslationPostprocessorFactory, Microsoft.EntityFrameworkCore.SqlServer.Query.Internal.SqlServer2008QueryTranslationPostprocessorFactory>();
                }
                else
                {
                    optionsBuilder.UseSqlServer(Admin.CYT369.Com.Utility.SystemSettingService.Instance.base_admin_cyt369_com_connection_string.ConnectionString);
                }
            base.OnConfiguring(optionsBuilder);
        }

        protected override void OnModelCreating(ModelBuilder builder)
        {

        }

    }
}
